#include <iostream>
#include <unordered_map>
#include <unordered_set>
using namespace std;
class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        unordered_map<int, int> aa;
        for (int a : nums) {
            aa[a]++;
            if (aa[a] >= 2) {
                return true;
            }
        }
        return false;
    }
};
class Solution {
public:
    bool containsDuplicate(vector<int>& nums) {
        unordered_set<int> aa;
        for (int a : nums) {
            if (aa.find(a) != aa.end()) {
                return true;
            }
            aa.insert(a);
        }
        return false;
    }
};